package com.wangzh.jvm;

import java.util.ArrayList;

//-Xmx2m -Xms1m  -XX:+HeapDumpOnOutOfMemoryError
//-Xmx200m -Xms100m  -XX:+PrintGCDetails
public class Demo3 {
    public static void main(String[] args) {
        ArrayList<Demo3> list = new ArrayList<>();
        int count=0;
        try {
            while (true) {
                list.add(new Demo3());
                count++;
            }
        } catch (Error e) {
            System.out.println(count);
            throw new RuntimeException(e);
        }
    }
}
